﻿namespace Devonline.Entity;

/// <summary>
/// 组织单位
/// </summary>
[DisplayName("组织单位")]
public class OrganizationViewModel : OrganizationViewModel<string>, IIdentity, IViewModel, IEntitySet
{
    /// <summary>
    /// 通用附件集合, NotMapped 用于记录实体对象上上传的附件
    /// </summary>
    public ICollection<Attachment>? Attachments { get; set; }
}

/// <summary>
/// 组织单位
/// </summary>
/// <typeparam name="TKey">主键类型</typeparam>
[DisplayName("组织单位")]
public abstract class OrganizationViewModel<TKey> : GroupViewModel<TKey>, IIdentity<TKey>, IViewModel<TKey>, IEntitySet<TKey> where TKey : IConvertible
{
    /// <summary>
    /// 单位编号, 单位注册号, 单位代码, 统一社会信用代码等
    /// </summary>
    [DisplayName("单位编号"), MaxLength(36), Excel]
    public virtual string? Code { get; set; }
    /// <summary>
    /// 单位地址
    /// </summary>
    [DisplayName("单位地址"), MaxLength(128), Excel]
    public virtual string? Address { get; set; }
    /// <summary>
    /// 注册日期
    /// </summary>
    [DisplayName("注册日期"), Excel]
    public virtual DateOnly? RegistrationDate { get; set; }
    /// <summary>
    /// 证件编号
    /// </summary>
    [DisplayName("证件编号"), MaxLength(36), Excel]
    public virtual string? CredentialId { get; set; }
}